import { Loading } from 'element-ui';

let loading = undefined;

/**
 * 开启加载
 * @param {*} msg 
 */
export const open_loading = (msg) => {
    loading = Loading.service({
        lock: true,
        text: msg || '请稍后...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
    });
}

/**
 * 关闭加载
 */
export const close_loading = () => {
    if (loading)
        loading.close();
}